package com.hejia.bulbul.scheduler;

import java.util.Date;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;

import com.hejia.alauda.service.BalanceAndFinancingService;;

/**
 * 用户回款入库调度程序 每天定时执行，计算回款金额入库。
 * 
 * @author hyr
 *
 */
public class PaymentCollectionInStockScheduler {

	private static final Log Logger = LogFactory.getLog(PaymentCollectionInStockScheduler.class);

	@Resource
	private BalanceAndFinancingService financialAssetStockService;

	// [秒] [分] [小时] [日] [月] [周] [年]
	//@Scheduled(cron = "0 30 0 * * ?")
	//@Async("executor")
	public void calculate() {
		
		Logger.info("开始计算回款金额入库");
		try {
			Date now = new Date();
			financialAssetStockService.calculatePaymentCollectionInStock(now);
			Logger.info("结束计算回款金额入库");
		} catch (Exception e) {
			Logger.error("计算回款金额入库失败", e);
		}
	}
}
